/**
	Create account dialogue.
 */
Ext.define('WEB.view.account.Create', {
	extend: 'Ext.window.Window',
	alias : 'widget.accountcreate',

	title : 'New Account',
	layout: 'fit',
	autoShow: true,
	resizable: false,
	modal: true,
	width: 350,
	
	initComponent: function() {
		this.items = [
			{
				xtype: 'form',
				bodyPadding: 10,
				border: false,
				items: [{
						xtype: 'textfield',
//						tabIndex: 10,
						anchor: '100%',
						name : 'firstName',
						fieldLabel: 'First Name',
						allowBlank: false
					},{
						xtype: 'textfield',
						anchor: '100%',
						name : 'lastName',
						fieldLabel: 'Last Name',
						allowBlank: false
					},{
						xtype: 'textfield',
						anchor: '100%',
						name : 'email',
						fieldLabel: 'Email',
						allowBlank: true
					},{
						xtype: 'textareafield',
						tabIndex: 35,
						anchor: '100%',
						grow: true,
						name : 'address',
						fieldLabel: 'Address'
					},{
						xtype: 'fieldcontainer',
						anchor: '100%',
						fieldLabel: 'City',
						layout: 'hbox',
						defaults: {
							margin: '0 1'
						},
						fieldDefaults: {
							msgTarger: 'under',
							labelAlign: 'top'
						},
						items: [{
							xtype: 'combo',
							tabIndex: 20,
							anchor: '100%',
							name : 'city_code',
							allowBlank: false,
							forceSelection: true,
//							store: 'Currencies',
//							queryMode: 'local',
							displayField: 'codename',
							valueField: 'code',
							emptyText: 'Select a city',
							flex: 4
						}]
					},{
						xtype: 'textfield',
						anchor: '100%',
						name : 'phoneNumber',
						fieldLabel: 'Phone Number',
						allowBlank: false
					}]
			}
		];

		this.buttons = [
			{
				text: 'Save',
				tabIndex: 40,
				action: 'save'
			},
			{
				text: 'Update',
				tabIndex: 40,
				action: 'update',
				visible: false					
			},
			{
				text: 'Cancel',
				tabIndex: 50,
				scope: this,
				handler: this.close
			}
		];

		this.on('show', function(wnd) {
			wnd.down("textfield[name=firstName]").focus(true, 200);
		});
		
		this.callParent(arguments);
	}
});